package com.senthink.gl.business.domain.entity;

import com.senthink.gl.business.common.entity.BornableEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;

/**
 * 区域实体类
 *
 * @author zooqi@senthink.com
 * @date 2017/11/22
 */
@Entity
@Table(name = "gl_area", indexes = {
        @Index(name = "idx_areas_aid", columnList = "aid", unique = true),
        @Index(name = "idx_areas_name", columnList = "area_name", unique = true)
})
@Getter
@Setter
public class Area extends BornableEntity<Long> {

    /**
     * 区域唯一id
     */
    @Column(name = "aid", nullable = false)
    private String aid;


    /**
     * 区域名称
     */
    @Column(name = "area_name", nullable = false)
    private String name;

    /**
     * 备注
     */
    @Column(name = "remarks")
    private String remarks;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Area)) return false;

        Area area = (Area) o;

        return aid.equals(area.aid);
    }

    @Override
    public int hashCode() {
        return aid.hashCode();
    }
}
